package com.ayz.gateway.client.executor;

import java.util.concurrent.Executor;

/**
 * @ClassName ResponseCallback
 * @Description TODO: 响应的回调函数
 * @Author 快乐的星球
 * @Date 2023/5/20 11:29
 * @Version 1.0
 **/
public interface ResponseCallback<Resp> {
    /**
     * 线程池池
     * @return
     */
    public default Executor getExecutor(){return null;}

    /**
     * 超时时间
     * @return
     */
    public default long getTimeout(){return 0;}

    /**
     * 请求执行成功回调
     * @param response
     */
    public void onSuccess(Resp response);

    /**
     * 请求执行失败回调
     * @param cause
     */
    public void onError(Throwable cause);
}
